home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / Apple Game Sprockets / InputSprocket / Sample Drivers / Common Driver Code / dprintf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-17  |  1.2 KB  |  53 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************
  2.  
  3. File:      dprintf.c
  4.  
  5. Copyright © 1996, 1997, 1998 Apple Computer, Inc., All Rights Reserved
  6.  
  7.  
  8. You may incorporate this sample code into your applications without
  9. restriction, though the sample code has been provided "AS IS" and the
  10. responsibility for its operation is 100% yours.  However, what you are
  11. not permitted to do is to redistribute the source as "DSC Sample Code"
  12. after having made changes. If you're going to re-distribute the source,
  13. we require that you make it clear in the source that the code was
  14. descended from Apple Sample Code, but that you've made changes.
  15.  
  16. *************************************************************************************/
  17. #include <MacTypes.h>
  18. #include "dprintf.h"
  19.  
  20. static void debug_message(
  21.     char *msg)
  22. {    
  23. //    mb_printf(msg);
  24.     debugstr(msg);
  25.     
  26.     return;
  27. }
  28.  
  29.  
  30. int dprintf(
  31.     const char *format,
  32.     ...)
  33. {
  34.     char buffer[257]; /* [length byte] + [255 string bytes] + [null] */
  35.     va_list arglist;
  36.     int return_value = 0;
  37.     
  38. #if DEBUG    
  39.     va_start(arglist, format);
  40.     return_value= vsprintf(buffer, format, arglist);
  41.     va_end(arglist);
  42.  
  43.     debug_message(buffer);    
  44. #else
  45.     arglist;
  46.     buffer;
  47.     format;
  48.     
  49. #endif
  50.     return return_value;
  51. }
  52.  
  53.